From: Mario Sanchez Prada Date: Tue, 26 Sep 2017 10:03:33 +0000 (+0100) Subject: messageTray: Check monitor's existence before trying to update the state X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~31 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=023b50e7a7002226d6176bede22930d96da074a9;p=gnome-shell.git messageTray: Check monitor's existence before trying to update the state Not doing this will throw a backtrace when running on headless mode and trying to show a notification, due to Main.layoutManager.primaryMonitor being undefined, so it's better to return early. https://bugzilla.gnome.org/show_bug.cgi?id=730551 --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 4704073eb..73e67ebbc 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -1205,8 +1205,9 @@ var MessageTray = new Lang.Class({ // _updateState() figures out what (if anything) needs to be done // at the present time. _updateState: function() { - this.actor.visible = !this._bannerBlocked && this._banner != null; - if (this._bannerBlocked) + let hasMonitor = Main.layoutManager.primaryMonitor != null; + this.actor.visible = !this._bannerBlocked && hasMonitor && this._banner != null; + if (this._bannerBlocked || !hasMonitor) return; // If our state changes caused _updateState to be called,